#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib.request
import time
class City_hotelController(object):
    def get_phone_info(self,_url,count):
        html_cont = urllib.request.urlopen(_url).read()
        html_obj = BeautifulSoup(html_cont, 'html.parser', from_encoding='gb18030')
        a_data = html_obj.find_all('a',class_='pul-title')
        for a_tag in a_data:
            xcurl = a_tag['href']
            xtitle = a_tag['title']
            print(xtitle.encode('utf-8').decode("utf-8"))



if __name__=='__main__':
    obj=City_hotelController()
    count=1
    _url='http://product.cnmo.com/all/product_t2_p'
    while True:
        url=_url+str(count)+'.html'
        obj.get_phone_info(url,count)
        print('-------------------------------%d-------------------------------' % count)
        count=count+1
        if count>110:
            exit()
        time.sleep(3)#停顿1秒